
function login() {
    $.ajax({
        type: "POST",
        url: '/login',
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify({name:$('.name').val()}),
        dataType: "json",
        success: function(data) {
            console.log(data);
            loadLoginUser();
        },
        error: function(data) {
            console.error(data);
        }
    });
}

function loadLoginUser() {
    $.get('/getLoginUser?rdm='+Math.random(),function (res) {
        console.log(res);
        if(res.data.name){
            $('.loginUserName').text(res.data.name);
            $('.login-a').hide();
        }
    });
}
loadLoginUser();
